import request from '@/utils/request'
import { requestPath } from '@/utils/global.js'

export function shelfListAPI(params) { // 书架列表
  return request({
    url: `${requestPath.resource}/bookshelf/page`,
    method: 'get',
    params
  })
}

export function shelfRemoveAPI(data) { //移除书架
  return request({
    url: `${requestPath.resource}/bookshelf/batch/delete`,
    method: 'post',
    data
  })
}

export function getBrowseAPI(params) { //阅读记录
  return request({
    url: `${requestPath.resource}/record/page`,
    method: 'get',
    params
  })
}

export function deleteAPI(data) { //单条删除记录
  return request({
    url: `${requestPath.resource}/record/delete/ids`,
    method: 'post',
    data
  })
}

export function bookAddShelf(data) { //加入书架/取消加入
  return request({
    url: `${requestPath.resource}/bookshelf/save`,
    method: 'post',
    data
  })
}

export function bookIsCheck(params) { //查询是否加入书架
  return request({
    url: `${requestPath.resource}/bookshelf/check-is-collect`,
    method: 'get',
    params
  })
}

export function batchDelAPI() { //清空历史记录
  return request({
    url: `${requestPath.resource}/record/batch/delete`,
    method: 'post'
  })
}

